package com.yjd.comm.asynmsg.util;

import com.yjd.comm.asynmsg.enums.MsgStatusStatusEnum;
import com.yjd.comm.asynmsg.enums.TaskMsgClientIdEnum;
import com.yjd.comm.asynmsg.enums.TaskMsgTypeEnum;
import com.yjd.comm.asynmsg.model.TaskMsgModel;
import com.yjd.comm.util.FrameUtil;

import java.util.Map;

/**
 * <b>description</b>：异步消息工具类 <br>
 * <b>time</b>：2015-5-19上午10:07:01 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class AsynMsgUtil {
	public static Long delay_time=(long) (10*60);
	@SuppressWarnings("rawtypes")
	public static TaskMsgModel buidTaskMsgModel(String ref_id, TaskMsgTypeEnum msgTypeEnum, Map extend_data_map,TaskMsgClientIdEnum client_id,String client_order_id) {
		TaskMsgModel taskMsgModel = new TaskMsgModel(msgTypeEnum.getMsgType(), ref_id, FrameUtil.getTime(null), null, MsgStatusStatusEnum.WAIT_DISPOSE.getValue(),
				(extend_data_map == null ? null : FrameUtil.json(extend_data_map)),client_id!=null?client_id.getValue():null,client_order_id);
		taskMsgModel.setVersion(0L);
		taskMsgModel.setMax_failure(5);
		taskMsgModel.setFailure(0);
		taskMsgModel.setPlan_ex_time(FrameUtil.getTime());
		return taskMsgModel;
	}
}
